package A2017;

/*
UDDLUULRUL
UURLLLRRRU
RRUURLDLRD
RUDDDDUUUU
URUDLLRRUU
DURLRLDLRL
ULLURLLRDU
RDLULLRDDD
UUDDUDUDLL
ULRDLUURRR
 */
public class _1_迷宫 {

	private static char[][] ch = new char[][] { "UDDLUULRUL".toCharArray(), "UURLLLRRRU".toCharArray(), "RRUURLDLRD".toCharArray(),
		"RUDDDDUUUU".toCharArray(), "URUDLLRRUU".toCharArray(), "DURLRLDLRL".toCharArray(),
		"ULLURLLRDU".toCharArray(), "RDLULLRDDD".toCharArray(), "UUDDUDUDLL".toCharArray(),
		"ULRDLUURRR".toCharArray() };;
	private static int[][] vis = new int[10][10];
	private static int ans;

	public static void main(String[] args) {
		for(int i=0;i<10;i++) {
			for(int j=0;j<10;j++) {
				f(i, j);
			}
		}
		
		System.out.println(ans);
	}
	private static void f(int i, int j) {
		if (i < 0 || i >9 || j < 0 || j >9) {
			ans++;
			return;
		}
		if(vis[i][j]==1) return;
		if (ch[i][j] == 'U'&&vis[i][j]==0) {
			vis[i][j]=1;
			f(i-1,j);
			vis[i][j]=0;
		}
		if (ch[i][j] == 'D'&&vis[i][j]==0) {
			vis[i][j]=1;
			f(i+1,j);
			vis[i][j]=0;
		}
		if (ch[i][j] == 'L'&&vis[i][j]==0) {
			vis[i][j]=1;
			f(i,j-1);
			vis[i][j]=0;
		}
		if (ch[i][j] == 'R'&&vis[i][j]==0) {
			vis[i][j]=1;
			f(i,j+1);
			vis[i][j]=0;
		}
	}

}
